package com.example.springboot.controller.loggerSendMailMessage;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/8/5 22:00
 */
@RestController
@RequestMapping("/logger")
@Slf4j
public class LoggerSendMailMessageController {
    @GetMapping("/mail")
    public String sendMailTest(int a, int b) {
        try {
            return String.valueOf(a / b);
        } catch (Exception ex) {
            log.error("div error! {}/{}错误{}", a, b, ex.getMessage());
            return "some error!";
        }
    }

    /**
     * 打印info日志，发送短信
     *
     * @return
     */
    @GetMapping("/info")
    public String testInfoSms() {
        log.info("触发了，发送短信");
        return "成功";
    }
}
